if (SERVER) then
	AddCSLuaFile("shared.lua");
	
	SWEP.Weight				= 5;
	SWEP.AutoSwitchTo		= false;
	SWEP.AutoSwitchFrom		= false;
end

if (CLIENT) then
	SWEP.PrintName			= "Copper Pickaxe";
	SWEP.Instructions		= "Primary fire: Mine from a rock or rocky surface.";
	SWEP.DrawAmmo			= false;
	SWEP.ViewModelFOV		= 55;
	SWEP.ViewModelFlip		= false;
	SWEP.CSMuzzleFlashes	= false;
	SWEP.Slot 				= 3;
	SWEP.SlotPos			= 2;
end;

SWEP.Base 					= "weapon_base";

SWEP.Spawnable				= false;
SWEP.AdminSpawnable			= false;

SWEP.ViewModel				= Model("models/weapons/v_copper_pickaxe.mdl");
SWEP.WorldModel				= Model("models/weapons/w_copper_pickaxe.mdl");

SWEP.Primary.ClipSize		= -1;
SWEP.Primary.DefaultClip	= -1;
SWEP.Primary.Automatic		= true;
SWEP.Primary.Ammo			= "none";

SWEP.Secondary.ClipSize		= -1;
SWEP.Secondary.DefaultClip	= -1;
SWEP.Secondary.Automatic	= false;
SWEP.Secondary.Ammo			= "none";

function SWEP:Initialize()
	self:SetWeaponHoldType("melee2");
	self.sound = Sound("weapons/iceaxe/iceaxe_swing1.wav");
end;

function SWEP:PrimaryAttack()
    self.Weapon:SetNextPrimaryFire(CurTime() +1);
    self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER);
	self.Owner:SetAnimation(PLAYER_ATTACK1);
	
	if (SERVER) then
		self.Owner:EmitSound(self.sound);
		
		local tr = self.Owner:EyeTrace(150);
		
		if (tr.Entity and IsValid(tr.Entity)) then
			if (tr.Entity:IsRockModel() or tr.Entity:GetModel() == GMS.SmallRockModel) then
				local process = {
					Entity = tr.Entity,
					Chance = 60,
					MinAmount = 1,
					MaxAmount = 5
				};
				
				self.Owner:DoProcess("Mining", 2, process);
			end;
		end;
    end;
end;

function SWEP:SecondaryAttack()
end;

function SWEP:Reload()
end;